package cn.iocoder.yudao.module.product.dal.mysql.cylindertype;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.product.dal.dataobject.cylindertype.CylinderTypeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.product.controller.admin.cylindertype.vo.*;

import java.util.List;

/**
 * 钢瓶类型 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CylinderTypeMapper extends BaseMapperX<CylinderTypeDO> {

    default PageResult<CylinderTypeDO> selectPage(CylinderTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CylinderTypeDO>()
                .likeIfPresent(CylinderTypeDO::getName, reqVO.getName())
                .eqIfPresent(CylinderTypeDO::getWeight, reqVO.getWeight())
                .eqIfPresent(CylinderTypeDO::getModelCode, reqVO.getModelCode())
                .eqIfPresent(CylinderTypeDO::getDimension, reqVO.getDimension())
                .eqIfPresent(CylinderTypeDO::getHeight, reqVO.getHeight())
                .eqIfPresent(CylinderTypeDO::getVolume, reqVO.getVolume())
                .eqIfPresent(CylinderTypeDO::getInnerDiameter, reqVO.getInnerDiameter())
                .eqIfPresent(CylinderTypeDO::getOuterDiameter, reqVO.getOuterDiameter())
                .eqIfPresent(CylinderTypeDO::getRemark, reqVO.getRemark())
                .eqIfPresent(CylinderTypeDO::getDeleted, 0)
                .betweenIfPresent(CylinderTypeDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(CylinderTypeDO::getUpdater, reqVO.getUpdater())
                .orderByDesc(CylinderTypeDO::getId));
    }

    default List<CylinderTypeDO> getCylinderTypeList(CylinderTypeRespVO reqVO){
        return selectList(new LambdaQueryWrapperX<CylinderTypeDO>()
                .likeIfPresent(CylinderTypeDO::getName, reqVO.getName())
                .eqIfPresent(CylinderTypeDO::getWeight, reqVO.getWeight())
                .eqIfPresent(CylinderTypeDO::getModelCode, reqVO.getModelCode())
                .eqIfPresent(CylinderTypeDO::getDimension, reqVO.getDimension())
                .eqIfPresent(CylinderTypeDO::getHeight, reqVO.getHeight())
                .eqIfPresent(CylinderTypeDO::getVolume, reqVO.getVolume())
                .eqIfPresent(CylinderTypeDO::getInnerDiameter, reqVO.getInnerDiameter())
                .eqIfPresent(CylinderTypeDO::getOuterDiameter, reqVO.getOuterDiameter())
                .eqIfPresent(CylinderTypeDO::getRemark, reqVO.getRemark())
                .eqIfPresent(CylinderTypeDO::getUpdater, reqVO.getUpdater())
                .orderByDesc(CylinderTypeDO::getId));
    }

}